import App from "./App";

// Pure Router
import pureRouter from "@/uni_modules/pure-router";
const pureRouterConfig = {
    // 跳转前的拦截（处理）函数
    before: (params = {}) => {
        console.log("Pure Router 跳转前的拦截（处理）函数 ->", params);
        uni.setStorageSync("PureRouterBeforeParams", params);
        return true;
    },

    // 跳转后的拦截（处理）函数
    after: (pageJsonConfig = {}) => {
        console.log("Pure Router 跳转后的拦截（处理）函数 ->", pageJsonConfig);
        uni.setStorageSync("PureRouterAfterPageJsonConfig", pageJsonConfig);
    },
};

// #ifndef VUE3
import Vue from "vue";
import "./uni.promisify.adaptor";
Vue.config.productionTip = false;
App.mpType = "app";
const app = new Vue({
    ...App,
});
app.$mount();
// #endif

// #ifdef VUE3
import { createSSRApp } from "vue";
export function createApp() {
    const app = createSSRApp(App);
    app.use(pureRouter, pureRouterConfig);
    return {
        app,
    };
}
// #endif
